﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace EasyClassWEBAPI.EntityClass
{
    public class StudyResource
    {
        [Key]
        [ScaffoldColumn(false)]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int FileID { get; set; }
        [Required]
        public string FileName { get; set; }

        public double FileSize { get; set; }

        public Post Post { get; set; }
        public StudyGroup StudyGroup { get; set; }

        public override bool Equals(object obj)
        {
            return obj is StudyResource resource &&
                   FileName == resource.FileName;
        }

        public override int GetHashCode()
        {
            return HashCode.Combine(FileName);
        }
    }
}
